package com.yucc.girlimages.ui;

import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.FragmentTransaction;

import com.actionbarsherlock.R.style;
import com.actionbarsherlock.view.MenuItem;

public class ShowCategoryActivity extends BaseActivity {

	@Override
	protected int _onCreate(Bundle arg0) {
		setTheme(style.Theme_Sherlock_Light_DarkActionBar) ;
		
		getSupportActionBar().setDisplayHomeAsUpEnabled(true) ;
		
		if (getSupportFragmentManager().findFragmentByTag("category") == null) {
			final FragmentTransaction ft = getSupportFragmentManager()
					.beginTransaction();
			ft.add(android.R.id.content, new ShowCategoryFragment(),
					"category");
			ft.commit();
		}
	    return ACTION_NOTHING ;
	}
	
	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		switch (item.getItemId()) {
			case android.R.id.home:
			Intent intent = new Intent(this, MainActivity.class);
			intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP) ;
			startActivity(intent);
			return true ;
		}
		return super.onOptionsItemSelected(item);
	}	
	
}
